<%-- 
    Document   : Modulo1Remove
    Created on : 08-oct-2011, 6:05:33
    Author     : PC-01
--%>
<%@page import="java.sql.*" %>
<%@page import="java.util.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

<%
        Connection conn = null;
        try {
            String sc = "jdbc:mysql://localhost:3306/upeu?user=root&password=";
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(sc);
            System.out.println("Conectado");
            //test
            String UserId = request.getParameter("UserId");
            String qry="delete from libros where UserId='"+UserId+"'";
            PreparedStatement ps=conn.prepareStatement(qry);//e l consultra
            int r=ps.executeUpdate();
            out.print(r+" datos afectados en la db <br>se elimino correctamente");
            out.print("<br> <a href=Modulo1Main.jsp>Retornar menu principal </a>");
            
        } catch (Exception e) {
            out.print("Error: " +e.getMessage());
        }
%> 
        
    </body>
</html>
